<?php
if($_SESSION['login'] != true) {
	die('Access danied');
}
//------------------------------
$db->query("SELECT count(statement_id) as liczba FROM \"" . $configDbPrefix . "statements\";");
$rows = $db->fetchArray();
$statementsCrawled = $rows[0]['liczba'];

$db->query("SELECT count(new_statement_id) as liczba FROM \"" . $configDbPrefix . "new_statements\" WHERE statement_id IS NULL;");
$rows = $db->fetchArray();
$statementsCrawlNew = $rows[0]['liczba'];

$db->query("SELECT count(new_statement_id) as liczba FROM \"" . $configDbPrefix . "new_statements\" WHERE statement_id IS NOT NULL;");
$rows = $db->fetchArray();
$statementsCrawlAgain = $rows[0]['liczba'];

$db->query("SELECT count(result_id) as liczba FROM \"" . $configDbPrefix . "results\";");
$rows = $db->fetchArray();
$resultsActual = $rows[0]['liczba'];

$db->query("SELECT count(result_history_id) as liczba FROM \"" . $configDbPrefix . "results_history\";");
$rows = $db->fetchArray();
$resultsArchival = $rows[0]['liczba'];

$db->query("SELECT count(addr_id) as liczba FROM \"" . $configDbPrefix . "url_addrs\";");
$rows = $db->fetchArray();
$uniqueUris = $rows[0]['liczba'];

$db->query("SELECT count(token_id) as liczba FROM \"" . $configDbPrefix . "tokens\";");
$rows = $db->fetchArray();
$tokensNum = $rows[0]['liczba'];

$db->query("SELECT count(*) as liczba FROM \"" . $configDbPrefix . "tokens_lemats\";");
$rows = $db->fetchArray();
$tokenLematsNum = $rows[0]['liczba'];

$db->query("SELECT count(token_id) as liczba FROM \"" . $configDbPrefix . "tokens_lemats\" GROUP BY token_id;");
$tokenLematsNumExactly = $db->numRows();

$db->query("SELECT count(word_id) as liczba FROM \"" . $configDbPrefix . "lematyzator\";");
$rows = $db->fetchArray();
$lematsNum = $rows[0]['liczba'];
?>
<table>
	<tr class="bgWhite">
		<th width="60%">Typ</th>
		<th width="40%">Wartość [sztuk]</th>
	</tr>
</table>
<br />
<table>
	<tr class="bgGray">
		<td width="60%">Hasła z pobranymi informacjami</td>
		<td width="40%"><b><?php echo number_format($statementsCrawled, 0, '', ' '); ?></b></td>
	</tr>
	<tr class="bgWhite">
		<td>Hasła oczekujące na pobranie informacji</td>
		<td><b><?php echo number_format($statementsCrawlNew, 0, '', ' '); ?></b></td>
	</tr>
	<tr class="bgGray">
		<td>Hasła oczekujące na ponowne pobranie informacji</td>
		<td><b><?php echo number_format($statementsCrawlAgain, 0, '', ' '); ?></b></td>
	</tr>
	<tr class="bgWhite">
		<td><b>Suma</b></td>
		<td><b><?php echo number_format($statementsCrawled + $statementsCrawlNew + $statementsCrawlAgain, 0, '', ' '); ?></b></td>
	</tr>
</table>
<br />
<table>
	<tr class="bgGray">
		<td width="60%">Liczba zgromadzonych pozycji aktualnych</td>
		<td width="40%"><b><?php echo number_format($resultsActual, 0, '', ' '); ?></b></td>
	</tr>
	<tr class="bgWhite">
		<td>Liczba zgromadzonych pozycji archiwalnych</td>
		<td><b><?php echo number_format($resultsArchival, 0, '', ' '); ?></b></td>
	</tr>
	<tr class="bgGray">
		<td><b>Suma</b></td>
		<td><b><?php echo number_format($resultsActual + $resultsArchival, 0, '', ' '); ?></b></td>
	</tr>
</table>
<br />
<table>
	<tr class="bgWhite">
		<td width="60%">Liczba zgromadzonych unikalnych* adresów URI</td>
		<td width="40%"><b><?php echo number_format($uniqueUris, 0, '', ' '); ?></b></td>
	</tr>
	<tr class="bgGray">
		<td>Liczba tokenów z haseł</td>
		<td><b><?php echo number_format($tokensNum, 0, '', ' '); ?></b></td>
	</tr>
</table>
<br />
<table>
<tr class="bgWhite">
		<td width="60%">Liczba tokenów z przyporządkowanymi lematami</td>
		<td width="40%"><b><?php echo number_format($tokenLematsNum, 0, '', ' '); ?></b></td>
	</tr>
	<tr class="bgGray">
		<td>Liczba tokenów lematyzowanych jednoznacznie</td>
		<td><b><?php echo number_format($tokenLematsNumExactly, 0, '', ' '); ?></b></td>
	</tr>
	<tr class="bgWhite">
		<td>Liczba tokenów lematyzowanych niejednoznacznie</td>
		<td><b><?php echo number_format($tokenLematsNum - $tokenLematsNumExactly, 0, '', ' '); ?></b></td>
	</tr>
	<tr class="bgGray">
		<td>Liczba pozycji lematyzatora</td>
		<td><b><?php echo number_format($lematsNum, 0, '', ' '); ?></b></td>
	</tr>
</table>
<br />
<div align="left">
	<small><i>* z ograniczeniem wymienionym w pracy: rozdział 4.2 b</i></small>
</div>
<?php
/*
*	FUNKCJE
*/



?>
